package com.cn.jiyun.contoller;



import com.cn.jiyun.entity.pojo.Entertainment;
import com.cn.jiyun.service.EntertainmentService;
import com.jiyun.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/entertainment")
public class EntertainmentController {

    @Autowired
    private EntertainmentService entertainmentService;

    @RequestMapping("/findPage")
    public Result<List<Entertainment>> findPage(){
        List<Entertainment> entertainments = entertainmentService.findPage();
        return Result.ok(entertainments);
    }

    @RequestMapping("/findById")
    public Result<Entertainment> findById(@RequestParam Integer entertainmentId){
        Entertainment entertainments = entertainmentService.findById(entertainmentId);
        return Result.ok(entertainments);
    }
}
